//
//  PeopleView.m
//  AILove
//
//  Created by 甘世清 on 2024/1/5.
//

#import "PeopleView.h"

@implementation PeopleView

 
- (void)SQ_UIViewForSelfView{
    self.backgroundColor = UIColor.blackColor;
    [self addSubview:self.headerView];
    [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
    
    UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular];
    UIVisualEffectView* visualView = [[UIVisualEffectView alloc]initWithEffect:effect];
    visualView.layer.cornerRadius = 10;
    visualView.layer.masksToBounds = YES;
     visualView.frame =CGRectMake(15, SCREEN_HEIGHT-105-90-FootHeight, SCREEN_WIDETH-30, 105);
      visualView.alpha = 0.90;
     [self addSubview:visualView];
    
    [self addSubview:self.leftButton];
    [self.leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self);
        make.size.mas_equalTo(80);
        make.top.equalTo(self).offset(SCREEN_HEIGHT-FootHeight-280);
    }];
    [self addSubview:self.loveButton];
    [self.loveButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right);
        make.size.mas_equalTo(80);
        make.top.equalTo(self).offset(SCREEN_HEIGHT-FootHeight-280);
    }];
    [self addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(27);
        make.bottom.equalTo(self.mas_bottom).offset(-160-FootHeight);
        make.height.mas_equalTo(24);
    }];
    [self addSubview:self.gender];
    [self.gender mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel.mas_right).offset(8);
        make.centerY.equalTo(self.nameLabel);
        make.size.mas_equalTo(18);
    }];
    
    [self addSubview:self.ageLabel];
    [self.ageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel);
        make.top.equalTo(self.nameLabel.mas_bottom).offset(12);
        make.height.mas_equalTo(16);
        make.width.mas_equalTo(45);
    }];
    
    [self addSubview:self.heightLabel];
    [self.heightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.ageLabel.mas_right).offset(8);
        make.top.equalTo(self.nameLabel.mas_bottom).offset(12);
        make.height.mas_equalTo(16);
        make.width.mas_equalTo(55);
    }];
    
    [self addSubview:self.tizhongLabel];
    [self.tizhongLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.heightLabel.mas_right).offset(8);
        make.top.equalTo(self.nameLabel.mas_bottom).offset(12);
        make.height.mas_equalTo(16);
        make.width.mas_equalTo(45);
    }];
    
    [self addSubview:self.subtitLabel];
    [self.subtitLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel);
        make.top.equalTo(self.ageLabel.mas_bottom).offset(12);
        make.height.mas_equalTo(16);
        make.width.mas_equalTo(SCREEN_WIDETH-30);
    }];
//    [self addSubview:self.rightButton];
//    [self.rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.centerY.equalTo(self.nameLabel);
//            make.height.mas_equalTo(24);
//            make.width.mas_equalTo(80);
//            make.right.equalTo(self.mas_right).offset(-27);
//    }];
}
-(void)SQ_data:(PeopleModel*)dic{
    [self.headerView sd_setImageWithURL:SQURLImage(dic.cover)];
    self.nameLabel.text = dic.name;
    self.ageLabel.text = [NSString stringWithFormat:@"%@%@",dic.age,SQNSLocalString(@"岁")];
    self.heightLabel.text =[NSString stringWithFormat:@"%@cm",dic.height];
    self.tizhongLabel.text =[NSString stringWithFormat:@"%@kg",dic.weight];
    self.subtitLabel.text = dic.tags;
    if ([dic.gender isEqualToString:@"0"]) {
        //男
        self.gender.image = SQGetImage(@"男");
    } else {
        //女
        self.gender.image = SQGetImage(@"女");
    }
}

- (UIImageView *)headerView{
    if (!_headerView) {
        _headerView = [[UIImageView alloc]init];
        _headerView.contentMode = UIViewContentModeScaleAspectFill;
        _headerView.layer.cornerRadius = 8;
        _headerView.layer.masksToBounds = YES;
        _headerView.clipsToBounds = YES;
    }
    return _headerView;
}
- (UILabel *)nameLabel{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.font = FONT_BOLD(18);
        _nameLabel.textColor =  SQColor(@"#FFFFFF");
        _nameLabel.backgroundColor = UIColor.clearColor;
        _nameLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _nameLabel;
}
- (UIImageView *)gender{
    if (!_gender) {
        _gender = [[UIImageView alloc]init];
        _gender.image = SQGetImage(@"性别");
    }
    return  _gender;
}
- (UILabel *)ageLabel{
    if (!_ageLabel) {
        _ageLabel = [[UILabel alloc]init];
        _ageLabel.backgroundColor = SQHexColor(@"#ffffff", 0.24);
        _ageLabel.layer.cornerRadius = 8;
        _ageLabel.layer.masksToBounds= YES;
        _ageLabel.textColor = SQColor(@"#FFFFFF");
        _ageLabel.font = FONT_MEDIUM(12);
        _ageLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _ageLabel;
}
- (UILabel *)heightLabel{
    if (!_heightLabel) {
        _heightLabel = [[UILabel alloc]init];
        _heightLabel.backgroundColor = SQHexColor(@"#ffffff", 0.24);
        _heightLabel.layer.cornerRadius = 8;
        _heightLabel.layer.masksToBounds= YES;
        _heightLabel.textColor = SQColor(@"#FFFFFF");
        _heightLabel.font = FONT_MEDIUM(12);
        _heightLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _heightLabel;
}
- (UILabel *)tizhongLabel{
    if (!_tizhongLabel) {
        _tizhongLabel = [[UILabel alloc]init];
        _tizhongLabel.backgroundColor = SQHexColor(@"#ffffff", 0.24);
        _tizhongLabel.layer.cornerRadius = 8;
        _tizhongLabel.layer.masksToBounds= YES;
        _tizhongLabel.textColor = SQColor(@"#FFFFFF");
        _tizhongLabel.font = FONT_MEDIUM(12);
        _tizhongLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _tizhongLabel;
}
- (UILabel *)subtitLabel{
    if (!_subtitLabel) {
        _subtitLabel = [[UILabel alloc]init];
        _subtitLabel.textColor = SQColor(@"#FFFFFF");
        _subtitLabel.font = FONT_MEDIUM(14);
    }
    return _subtitLabel;
}
 
- (HeaderView *)rightButton{
    if (!_rightButton) {
        _rightButton = [[HeaderView alloc]init];
        _rightButton.image = @"按钮背景";
        _rightButton.text = SQNSLocalString(@"封面替换");
        _rightButton.font = FONT_MEDIUM(14);
        _rightButton.colorString = @"#FFFFFF";
        _rightButton.layer.cornerRadius = 12;
        _rightButton.layer.masksToBounds = YES;
    }
    return _rightButton;
}

- (SQCustomButton *)leftButton{
    if (!_leftButton) {
        _leftButton = [[SQCustomButton alloc]initType:SQCustomButtonTopImageType imageSize:CGSizeMake(50, 50) midmargin:0];
        _leftButton.image = SQGetImage(@"不喜欢");
    }
    return _leftButton;
}
- (SQCustomButton *)loveButton{
    if (!_loveButton) {
        _loveButton = [[SQCustomButton alloc]initType:SQCustomButtonTopImageType imageSize:CGSizeMake(50, 50) midmargin:0];
        _loveButton.image = SQGetImage(@"喜欢");
    }
    return _loveButton;
}

@end
